<?php
require_once 'PHPUnit\Framework.php';
require_once 'MyDatabase.class.php';
require_once 'helpFunctions.php';
define("PASS_FILE_NAME",dirname(__FILE__).'\password');
class TestMyDB extends PHPUnit_Framework_TestCase {
	protected $fixture;
	public function setUp() {
		$this -> fixture = new MyDatabase(PASS_FILE_NAME);
	}
	
	public function testConstructor() {
		$mydb = new MyDatabase(PASS_FILE_NAME);
		$this->assertEquals($mydb -> getServer(),"localhost");
		$this->assertEquals($mydb -> getUser(),"root");
		$this->assertEquals($mydb -> getPassword(),"hungspn");
	}
	
	
	public function  testMT_allEntries() {
		$arr = array(
			array("id" => 1,"name" => "Son"),
			array("id" => 2,"name" => "Huong"),
			array("id" => 3,"name" => "Convit")
		);
		$this->assertTrue(HelpFunctions::equalsArray($arr,$this->fixture-> allEntries('users','usernames')));
	}
}
?>
